#/bin/bash

function screen_run() {
    screen_name=$1
    echo cmd: $cmd
    screen -dmS $screen_name
    screen -x -S $screen_name -p 0 -X stuff "$cmd"
    screen -x -S $screen_name -p 0 -X stuff $'\n'
}

echo "starting es"
cmd='${HOME}/opt/elasticsearch/bin/elasticsearch'
screen_run "es" "$cmd"

echo "starting virtuoso"
cmd='cd ${HOME}/codes/KQAPro_Baselines/virtuoso-KQAPro; bash start_virtuoso.sh'
screen_run "virtuoso" "$cmd"
